<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>提交</title>
    </head>
    <body>
        <form name="frmLx1" method="post" style="text-align: center" onsubmit="return funCheck()">
            姓名：<input type="text" name="txtName" id="text"><br>
            <input type="submit" value="注册">
        </form>
        <script>
            function funCheck(){
                let nu = document.getElementById("text").value;
                if(nu==='') {
                    window.alert("未输入数据");
                    return false;
                }
                return true;
            }
        </script>
    </body>
</html>